<template>
    <div class="briefonlineresume">
        <van-nav-bar title="详细在线简历" @click-right="yulan(customerInfo.id)" left-text="" fixed placeholder left-arrow @click-left="returns">
            <template #right>
                <span>预览</span>
            </template>
        </van-nav-bar>
        <div class="content">
            <van-cell-group style="height:130px">
                <div class="title">
                    <div class="title-item" @click="jibenmsgBj(customerInfo.id)">
                        <h2>基本信息</h2>
                        <img src="../../assets/images/resume/update.png" alt="">
                    </div>
                    <div class="title-content-item">
                        <img :src="customerInfo.cover" alt="">
                        <span>{{customerInfo.name}}</span>
                    </div> 
                </div>
            </van-cell-group>
            <van-cell-group>
                <div class="title">
                    <div class="title-item">
                        <h2>详细信息</h2>
                    </div>
                     <div style="margin-top:10px">
                        <div class="title-content-items" @click="$router.push({path:'/resumedetailmsg',query:{msg:2,id:customerInfo.id,recruitId:$route.query.recruitId}})">
                            <span>去完善</span>
                            <img style="margin-top:20px" src="../../assets/images/resume/jiantou.png" alt="">
                        </div>
                    </div>
                </div>
            </van-cell-group>
            <van-cell-group>
                <div class="title">
                    <div class="title-item" @click="$router.push({path:'/detaildonlineresumeform',query:{msg:2,id:customerInfo.id,recruitId:$route.query.recruitId}})"> 
                        <h2>教育背景</h2>
                        <img src="../../assets/images/resume/add.png" alt="">
                    </div>
                    <div style="margin-top:10px" v-for="(item,index) in customerInfo.crmPersonnelEducationEntity" :key="index">
                        <div class="title-content-items" @click="$router.push({path:'/detaildonlineresumeform',query:{msg:2,id:customerInfo.id,jiaoyuid:item.id,recruitId:$route.query.recruitId}})">
                            <span>{{item.school}}</span>
                            <img src="../../assets/images/resume/jiantou.png" alt="">
                        </div>
                        <div class="contents-item">
                            <span><span style="font-size:14px">专业：{{item.major}}</span></span>
                        </div>
                    </div>
                </div>
            </van-cell-group>
             <van-cell-group>
                <div class="title">
                    <div class="title-item" @click="$router.push({path:'/detaildonlineresumeform',query:{msg:3,id:customerInfo.id,recruitId:$route.query.recruitId}})">
                        <h2>工作经历</h2>
                        <img src="../../assets/images/resume/add.png" alt="">
                    </div>
                    <div style="margin-top:10px" v-for="(item,index) in customerInfo.crmWorkExperienceEntity" :key="index">
                        <div class="title-content-items" @click="$router.push({path:'/detaildonlineresumeform',query:{msg:3,id:customerInfo.id,gongzuoid:item.id,recruitId:$route.query.recruitId}})">
                            <span>{{item.companyName}}</span>
                            <img src="../../assets/images/resume/jiantou.png" alt="">
                        </div>
                        <div class="contents-item">
                            <span style="font-size:14px">在职时间：{{item.startTime}}至{{item.endTime}}</span>
                        </div>
                    </div>
                </div>
            </van-cell-group>
            <van-cell-group>
                <div class="title">
                    <div class="title-item"  @click="$router.push({path:'/detaildonlineresumeform',query:{msg:4,id:customerInfo.id,recruitId:$route.query.recruitId}})">
                        <h3>家庭成员</h3>
                        <img src="../../assets/images/resume/add.png" alt="">
                    </div>
                    <div style="margin-top:10px" v-for="(item,index) in customerInfo.crmFamilyMember" :key="index">
                         <div class="title-content-items" @click="$router.push({path:'/detaildonlineresumeform',query:{msg:4,id:customerInfo.id,jiatingid:item.id,recruitId:$route.query.recruitId}})">
                            <span>{{item.name}}</span>
                            <img src="../../assets/images/resume/jiantou.png" alt="">
                        </div>
                        <div class="contents-item">
                            <span>{{item.relation}}</span>
                        </div>
                    </div>
                </div>
            </van-cell-group>
           <van-cell-group>
                <div class="title">
                    <div class="title-item"  @click="$router.push({path:'/detaildonlineresumeform',query:{msg:5,id:customerInfo.id,recruitId:$route.query.recruitId}})">
                        <h2>自我评价</h2>
                        <img src="../../assets/images/resume/add.png" alt="">
                    </div>
                    <div class="title-content-items"  @click="$router.push({path:'/detaildonlineresumeform',query:{msg:5,id:customerInfo.id,remark:customerInfo.remark,recruitId:$route.query.recruitId}})">
                        <span>{{customerInfo.remark}}</span>
                        <img v-if="customerInfo.remark" src="../../assets/images/resume/jiantou.png" alt="">
                    </div>
                </div>
            </van-cell-group>
            <div class="btn" @click="daochujianli">
                <span>查看简历</span>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return{
            customerInfo:{}
        }
    },
    mounted(){
        if(this.$route.query.id){
            this.getCustomerInfo(this.$route.query.id)
        }
    },
    methods:{
        returns(){
            this.$router.push({path:"/resume",query:{id:this.$route.query.recruitId}})
        },
        daochujianli(){
            let obj = { 
                "userId": sessionStorage.getItem("agentIds"), 
                "name": this.customerInfo.name, 
                "idCard":this.customerInfo.idCard,
                "nativePlace":this.customerInfo.nativePlace,
                "nation":this.customerInfo.nation,
                "marriage":this.customerInfo.marriage,
                "height":this.customerInfo.height,
                "weight":this.customerInfo.weight,
                "politicalStatus":this.customerInfo.politicalStatus,
                "accountAddress":this.customerInfo.accountAddress,
                "detailedAddress":this.customerInfo.detailedAddress,
                "schoolTag":this.customerInfo.graduate,
                "graduation":this.customerInfo.graduateTime,
                "education":this.customerInfo.education,
                "certificate":this.customerInfo.certificate,
                "computerLevel":this.customerInfo.computers,
                "englishLevel":this.customerInfo.foreignLanguages,
                "qq":this.customerInfo.qqNumber,
                "weChat":this.customerInfo.weChatNo,
                "sex": this.customerInfo.gender, 
                "phone":this.customerInfo.phone,
                "birth":this.customerInfo.birth,
                "workTime":this.customerInfo.workTime,
                "email":this.customerInfo.email,
                "cover":this.customerInfo.cover,
                "educations":this.customerInfo.crmPersonnelEducationEntity,
                "crmWorkExperienceEntity":this.customerInfo.crmWorkExperienceEntity,
                "familyMembers":this.customerInfo.crmFamilyMember,
                "remark":this.customerInfo.remark
            }
            this.$api.detailpersonalResume(obj).then(res=>{
                 this.$router.push({path:"/pdfpreview",query:{url:res.url}})
            })
        },
        jibenmsgBj(id){
            if(id==""){
                this.$router.push({path:'/detaildonlineresumeform',query:{msg:1,recruitId:this.$route.query.recruitId}})
            }else{
                this.$router.push({path:'/detaildonlineresumeform',query:{msg:1,id:id,recruitId:this.$route.query.recruitId}})
            }
        },
        yulan(id){
            this.$router.push({path:'/onlineresume',query:{id:id}})
        },
        getCustomerInfo(id){
            this.$api.getCustomerInfo({id:id}).then(res=>{
                this.customerInfo=res.data
            })
        },
    }
}
</script>

<style lang="less" scoped>
.content{
    width:100%;
    height: ceil(100vh+30px);
    .btn{
        width: 80%;
        height: 41px;
        opacity: 1;
        background: #f6f6f6;
        border-radius: 41px;
        text-align: center;
        margin:40px auto;
        line-height: 41px;
    }
    .title{
        line-height: 35px;
        .title-item{
            display: flex;
            justify-content: space-between;
            padding: 12px;
            h3{
                font-size: 16px;
            }
            img{
                width:16px;
                height:16px;
                margin-top: 7px;
            }
        }
        .title-content-item{
            display: flex;
            img{
                width: 45px;
                height: 45px;
                border-radius: 2em;
                margin-left: 10px;
            }
            span{
                display: block;
                margin: 7px 15px;
            }
        }
        .title-content-items{
            margin-top: -20px;
            display: flex;
            justify-content: space-between;
            img{
                width: 12px;
                height: 12px;
                border-radius: 2em;
                margin-right: 20px;
                margin-top: 16px;
            }
            span{
                display: block;
                margin: 7px 15px;
                font-size: 15px;
            }
        }
        .contents-item{
            margin-left: 15px;
            color: #999;
        }
    }
}
</style>